/*
 * Copyright (c) 2021. Moses All Right Reserved
 */

package com.moses.design_patterns.proxy.static_proxy.abstract_proxy;

/**
 * @author Moses
 * @email shenhuohui@gmail.com
 * @date 2021/4/10 18:50
 */
public class RealSubject2 extends ProxiedAbstractSubject {
    private ProxiedAbstractSubject proxy = null;
    @Override
    public void method() {
        if(proxy !=null){
            proxy.method();
        }else {
            System.out.println("请先获得代理");
        }
    }

    @Override
    public ProxiedAbstractSubject getProxy() {
        this.proxy = new Proxy2(this);
        return this.proxy;
    }
}
